Skip to content

Fix IL warnings in AddDownstreamApis method#3355

Merged
GeoK merged 7 commits into
masterfrom
geok/fix-src-gen
May 13, 2025
Merged

Fix IL warnings in AddDownstreamApis method#3355
GeoK merged 7 commits into
masterfrom
geok/fix-src-gen

Conversation

@GeoK
Copy link
Copy Markdown
Member

@GeoK GeoK commented May 9, 2025

Fix IL warnings in AddDownstreamApis method

Invoking AddDownstreamApis method results in IL2026/IL3050 warnings.
Even though source generator for configuration binding is enabled on IdentityModel.DownstreamApi project, the generator can't run on a reference to the Bind method.
Bind needs to be actually invoked directly in the code as a workaround.

See also https://github.com/dotnet/aspire/blob/2ed738cb524f7ce82490f0da33a1ea3e194011e8/src/Components/Aspire.Azure.Messaging.ServiceBus/AspireServiceBusExtensions.cs#L104-L106

Fixes #3360

Copy link
Copy Markdown
Collaborator

@jmprieur jmprieur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Thanks @GeoK

@jmprieur
Copy link
Copy Markdown
Collaborator

@GeoK
you probably need to adjust the number of warnings in the build/test-aot.ps1 file.

@GeoK GeoK changed the title Geok/fix src gen Fix IL warnings in AddDownstreamApis method May 13, 2025
@GeoK GeoK marked this pull request as ready for review May 13, 2025 22:01
@GeoK GeoK requested a review from a team as a code owner May 13, 2025 22:01
@GeoK GeoK force-pushed the geok/fix-src-gen branch from 339d7b7 to acc79f8 Compare May 13, 2025 22:02
@GeoK GeoK merged commit 3421d5d into master May 13, 2025
5 checks passed
@GeoK GeoK deleted the geok/fix-src-gen branch May 13, 2025 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AddDownstreamApis method produces IL warnings when consumed from other NativeAOT enabled projects

3 participants